﻿using System.Drawing;
using System.Windows.Forms;
using CartoGraphic.Model2;
namespace CartoGraphic.MyTool
{
    class ToolPoint : ToolObj
    {
        public ToolPoint()
        {
            Cursor = Cursors.Default;
        }

        public override void OnMouseDown(DrawArea drawArea, MouseEventArgs e)
        {
            Point p = drawArea.BackTrackMouse(new Point(e.X, e.Y));
            AddNewObject(drawArea, new SimplePoint(p.X, p.Y,4,Color.Black,Color.Black,true));
        }

        public override void OnMouseMove(DrawArea drawArea, MouseEventArgs e)
        {
            drawArea.Cursor = Cursor;

            if (e.Button ==
                MouseButtons.Left)
            {
                Point point = drawArea.BackTrackMouse(new Point(e.X, e.Y));
                string al = drawArea.TheLayers.ActiveLayerIndex;
                drawArea.TheLayers[al].Graphics[0].MoveHandleTo(point, 2);
                drawArea.Refresh();
            }
        }
    }
}
